const Mock = require('mockjs');
const _ = require('lodash');

const Random = Mock.Random;
const data = Mock.mock({
    // 属性 list 的值是一个数组，其中含有 1 到 10 个元素
  'locs|10': [{
        // 属性 id 是一个自增数，起始值为 1，每次增 1
    'WLID|+1': 1,
    'WID|+2': 2,
    Area: () => Random.name(),
    Floor: () => Random.integer(1, 100),
    Code: () => Random.name(),
    Status: () => Random.integer(0, 1),
    Company: () => Random.cname(),
    Remark: () => Random.csentence(),
    Row: () => Random.integer(1, 1000),
    Col: () => Random.integer(1, 1000),
  }],
  'warehouse|20': [
    {
      'WID|+1': 1,
      Father: () => Random.integer(1, 100),
      Capacity: () => Random.integer(100, 1000),
      Place: () => Random.city(),
      TheName: () => `${Random.cname()}大仓库`,
      Contact: () => Random.name(),
    },
  ],
  'area|20': [
    {
      'id|+1': 2,
    },
  ],
});

_.merge(data, {
  user: {
    id: 1,
    wid: 1,
    username: 'yangli',
    role: 'admin',
  },
});

module.exports = data;
